# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'libjpeg-turbo'
    version = '1.5.3'
    licenses = [{License.BSD_like: ['LICENSE.md']}]
    stype = SourceType.TARBALL
    url = 'sf://.tar.gz'
    tarball_checksum = 'b24890e2bb46e12e72a79f7e965f409f4e16466d00e1dd15d93d73ee6b592523'

    configure_tpl = "%(config-sh)s --prefix=%(prefix)s "\
                    "--libdir=%(libdir)s"
    configure_options = " --with-jpeg8"
    autoreconf = True
    patches = []

    files_libs = ['libjpeg','libturbojpeg']
    files_devel = ['include/jpeglib.h', 'include/jerror.h', 'include/jconfig.h',
                   'include/jmorecfg.h','include/turbojpeg.h', 'lib/pkgconfig/libjpeg.pc']

    def prepare(self):
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            # avoid using xcode's nasm (doesn't support nasm-like arguments)
            # instead use cerbero's yasm
            self.set_env('NASM', 'yasm')
